import PaginationDto from "apps/admin/src/dtos/pagination.dto";
import { ArrayMaxSize, IsArray, IsBoolean, IsNotEmpty, IsNumber, IsOptional, IsString, Max, MaxLength, Min } from "class-validator";

class CommonDto {
    @MaxLength(30)
    @IsNotEmpty()
    @IsString()
    name:string;


    @Max(100)
    @Min(0)
    @IsNumber()
    @IsOptional()
    profitRate:number;


    @MaxLength(30)
    @IsString()
    @IsOptional()
    leader:string;

    @MaxLength(11)
    @IsString()
    @IsOptional()
    tel:string;


    @IsBoolean()
    @IsOptional()
    enable:boolean;


    @ArrayMaxSize(100)
    @IsArray()
    @IsOptional()
    roles:number[]
    
}

export class AddDto extends CommonDto {
    @IsNumber()
    @IsOptional()
    creatorId:number;

    @IsNumber()
    @IsOptional()
    createTime:number;

    @MaxLength(30)
    @IsNotEmpty()
    @IsString()
    account:string;

    @IsNumber()
    @IsOptional()
    memberId:number;
}

export class EditDto extends CommonDto {
    @IsNumber()
    @IsOptional()
    updateTime:number;
}


export class PageDto extends PaginationDto {
    @MaxLength(30)
    @IsString()
    @IsOptional()
    name:string;
}